home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1232 < prev    next >
Encoding:
Text File  |  1996-08-06  |  3.0 KB  |  79 lines

  1. Newsgroups: comp.lang.c++
  2. Path: ncrgw2.ncr.com!ncrhub6!daynews!falcon!news
  3. From: Dick Menninger <Dick.Menninger@DaytonOH.ATTGIS.COM>
  4. Subject: Re: Exceptions vs. assertions
  5. X-Nntp-Posting-Host: 149.25.99.44
  6. Message-ID: <DKxspD.6Ev@falcon.daytonoh.attgis.com>
  7. Sender: news@falcon.daytonoh.attgis.com (News administrative Login)
  8. Reply-To: Dick.Menninger@DaytonOH.ATTGIS.COM (mennid)
  9. Organization: AT&T Global Information Solutions
  10. X-Newsreader: DiscussIT 2.5.1.3 for MS Windows [AT&T Software Products Division]
  11. References: <4crar1$9oh@dawn.mmm.com>
  12. Date: Tue, 9 Jan 1996 23:17:36 GMT
  13.  
  14.  
  15. > ==========Kevin J Hopps, 1/8/96==========
  16. > Dick Menninger (Dick.Menninger@DaytonOH.ATTGIS.COM) wrote:
  17. > > > ==========Kevin J Hopps, 1/2/96==========
  18.  
  19. [Stuff deleted]
  20.  
  21. > > I suspect there are problems to be modeled
  22. > > where they are best expressed with an exception used for
  23. > > the success path.  In fact, that is one of the reasons I push
  24. > > for multiple simultaneous exceptions being valid in the language
  25. > > (so you can have an error exception while returning a success
  26. > > exception).
  27.  
  28. > I'm not sure what you mean by "multiple simultaneous exceptions."
  29.  
  30. I mean that the language should allow [and provide
  31. effective means to handle] more than one exceptional
  32. condition to exist at the same time.
  33.  
  34. As it currently stands, if you are doing any form
  35. of high reliability system, once an exception has
  36. been thrown, you have to stand on your head to
  37. prevent a second from being thrown.  You wind up
  38. having to catch early and often and never propogate
  39. it back as an exception.  Instead, you are forced
  40. to use the old [but familiar] severe distortion of
  41. using return codes to propogate errors back up.
  42. This says to me that exceptions were a nice idea
  43. whose implementation in the language design
  44. failed to live up to expectations and goals.
  45.  
  46.  
  47. > > Such problems are likely to be related to problems
  48. > > where multi-level breaks (usually simulated by a goto) are very
  49. > > helpful in clarifying the expression of the model.  For such
  50. > > problems, the solution may perform better with an exception
  51. > > for success.
  52.  
  53. > Even if I thought that using a goto to simulate a multi-level break
  54. > was very helpful in clarifying the expression of the model, I would
  55. > probably avoid it if it both
  56. >     a) was likely to occur with significant frequency, and
  57. >     b) made the code 2-3 times slower.
  58.  
  59. If it made the code slower, it is probably the wrong
  60. choice, though low frequency of use of the code
  61. could say that only clarity of expression matters.
  62. But the cases that I have seen improved both
  63. clarity and performance.  It may have been true
  64. that a much more functionalized approach would
  65. have been as clear, but that was not on
  66. the radar screen because of severe performance
  67. penalties of such a solution to the particular
  68. problems in question.  I am NOT advocating
  69. wide spread use of this.  But if you tell me not
  70. to use it ever, I will simply ignore you when it
  71. winds up being the tool that hits the nail on the head.
  72.  
  73. Good Day
  74. Dick
  75. Dick.Menninger@DaytonOH.ATTGIS.COM
  76.  
  77.